% autowrite prob
clc
clear all
load 'D:\My Documents\CIRANO\db_mySQL\tp_2012Mar5_MR7_WR.mat' cohTpGrp NUMBER_OF_YEAR numGrp numEdges ;
filename1='tp_2012Mar5_MR7_WR_NR.xls';
year_list=(1998:2009)';
year_list_text=num2str(year_list);

% autowrite matrices
for yearIdx=1:NUMBER_OF_YEAR
    sheetlist=strcat('',year_list_text(yearIdx,:),'');
    for cdIdx = 1: numGrp
        
        c(:,:)=cohTpGrp(cdIdx,yearIdx,:,:)./100;
        %d(:,:)=cohTpGrp(cdIdx,yearIdx,:,:)./100;
        
        p = 3+ 9*(cdIdx-1);
        xlswrite(filename1, c, sheetlist,strcat('b','',num2str(p),''));
        %xlswrite(filename1, d, sheetlist,strcat('k','',num2str(p),''));
        clear c 
        
        grp = strcat('',num2str(cdIdx),'');
        xlswrite(filename1, {strcat('Group', '',grp,'')}, sheetlist,strcat('A','',num2str(p-1),''));
        
    end
end


